<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

mm_showMyFileName( __FILE__ );

$category_id = @JRequest::getInt("category_id",0);

$db =& JFactory::getDBO();
$q = "SELECT a.`product_id`, a.`product_name`, a.`product_thumb_image`, a.`product_full_image`, a.`product_price`, a.`product_currency` FROM #__vm_product_category_xref b INNER JOIN (";
$q .= "SELECT pd.`product_id`, `product_name`, `product_thumb_image`, `product_full_image`, `product_price`, `product_currency` ";
$q .= "FROM #__vm_product pd inner join #__vm_product_price pd_p ";
$q .= "ON pd.product_id = pd_p.product_id ";
$q .= "WHERE pd.`product_publish` = 'Y' ";
$q .= ") a ON a.`product_id` = b.`product_id`";
$q .= "WHERE b.`category_id` = $category_id";
$db->setQuery($q);
$list = $db->loadObjectList();

echo "<pre>";
var_dump($list);
echo "</pre>";

$tpl = vmTemplate::getInstance();

$tpl->set('product_list',$list);
$flypage = "shop.products.tpl";
echo $tpl->fetch( '/pages/'.$flypage . '.php' );
?>